﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/OnlyAuthenticated/GeneratorMasterPage.master" Inherits="OnlyAuthenticated_OnlyManagers_EditUseri" CodeBehind="EditUseri.aspx.cs" %>


<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="GeneratorPageContent">

    <h2>Useri
    </h2>

    <h3>Vizualizare, Editare, Stergere, Activare/Dezactivare Useri</h3>
    <p>&nbsp;</p>

    <asp:GridView ID="GridView1" runat="server" AllowSorting="True" DataSourceID="UsersSqlDataSource"
        AutoGenerateColumns="False" Width="780px" DataKeyNames="UserName">
        <Columns>
            <asp:BoundField DataField="UserName" HeaderText="User"
                SortExpression="UserName" ReadOnly="True">
                <ControlStyle Width="150px" />
                <ItemStyle Width="150px" />
            </asp:BoundField>
            <asp:BoundField DataField="RoleName" HeaderText="Rol"
                SortExpression="RoleName">
                <ItemStyle Width="70px" />
                <ControlStyle Width="70px" />
            </asp:BoundField>
            <asp:BoundField DataField="Email" HeaderText="Email"
                SortExpression="Email">
                <ControlStyle Width="98%" />
                <ItemStyle Width="200px" />
            </asp:BoundField>
            <asp:CheckBoxField DataField="IsApproved" HeaderText="Activ"
                SortExpression="IsApproved">
                <ControlStyle Width="98%" />
                <ItemStyle Width="20px" HorizontalAlign="Center" />
            </asp:CheckBoxField>
            <asp:BoundField DataField="Comment" HeaderText="Comentarii"
                SortExpression="Comment">
                <ControlStyle Width="98%" />
                <ItemStyle Width="150px" />
            </asp:BoundField>
            <asp:BoundField DataField="CreateDate" HeaderText="DataCrearii"
                SortExpression="CreateDate" ReadOnly="True">
                <ControlStyle Width="50px" />
                <ItemStyle Width="80px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="LastLoginDate" HeaderText="UltimulLogin"
                SortExpression="LastLoginDate" ReadOnly="True">
                <ControlStyle Width="80px" />
                <ItemStyle Width="80px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:CommandField DeleteText="Sterge" ShowDeleteButton="True"
                ShowEditButton="True" UpdateText="OK" />
        </Columns>
        <EditRowStyle Width="780px" Wrap="False" />
    </asp:GridView>

    <asp:SqlDataSource ID="UsersSqlDataSource" runat="server"
        ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
        DeleteCommand="BjDeleteUser" DeleteCommandType="StoredProcedure"
        SelectCommand="SELECT aspnet_Users.UserName, aspnet_Users.UserId, aspnet_Roles.RoleName, aspnet_Membership.Email, aspnet_Membership.IsApproved, aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate, aspnet_Membership.Comment FROM aspnet_Users INNER JOIN aspnet_UsersInRoles ON aspnet_Users.UserId = aspnet_UsersInRoles.UserId INNER JOIN aspnet_Roles ON aspnet_UsersInRoles.RoleId = aspnet_Roles.RoleId INNER JOIN aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId"
        UpdateCommand="BjUpdateUser" UpdateCommandType="StoredProcedure">

        <DeleteParameters>
            <asp:Parameter Name="ApplicationName" Type="String" DefaultValue="/" />
            <asp:Parameter Name="UserName" Type="String" DefaultValue="/" />
            <asp:Parameter Name="TablesToDeleteFrom" Type="Int32" DefaultValue="15" />
        </DeleteParameters>

        <UpdateParameters>
            <asp:Parameter Name="ApplicationName" Type="String" DefaultValue="/" />
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="RoleName" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="IsApproved" Type="Boolean" />
            <asp:Parameter Name="Comment" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>

